Borland Online And The Cobb Group Present:


December, 1995 - Vol. 2 No. 12

Power-user text editing

The Borland C++ Integrated Development Environment (IDE) provides powerful text editing ability via the editing windows. However, because there are so many options, it's easy to overlook some of the IDE's fundamental capabilities. In this article, we'll show you three ways you can use the IDE's editing windows to your best advantage.

Opening source files quickly

Since Borland C++ is a development tool, it's only natural for users to review source files frequently. To make this task easier, the IDE provides the Open Source speed menu command.

If a filename appears in one of your source files, you can position the cursor anywhere within or adjacent to that name and then right-click to display the speed menu. From the speed menu, if you choose Open Source, the IDE will open a new editing window and load the contents of the file whose name you clicked into the new page. (Note that this works only if the file is in the project's directory or in one of the directories listed in the Source entry field of the Project Options dialog box's Directories page.)

However, except for some rare situations, the names of your project's source files don't normally appear in the source code of another file. Despite this fact, you can still use this feature of the IDE's editing windows. Simply type the name of the file you want to open in the current file window, press [Ctrl][O], and then press [A], the keyboard shortcut for the Open Source speed menu command. (Be sure that you delete the filename before you try to compile the current file. Otherwise, the IDE will generate an error when it tries to interpret the meaning of the filename.)

Creating a file in a specific directory

If you want to create a new file, you may want to create it in a location other than the current directory. Normally, you might choose New from the File menu to open a new editing window, enter the appropriate information in the window, and then choose Save or Save As... to specify the filename and path.

However, if there's already a file with the name you've entered, you'll see a "File Already Exists" error message. In that case, you'd probably want to open the file, review its contents, and then make your decision about overwriting the file.

Instead, you can choose Open... from the File menu and enter the path and filename you want to use for the new file. If the file already exists, the IDE will display the file in the new window. If it doesn't, the IDE will create the new file for you as soon as you save the contents of the editing window.

Reversing a text search

If you're searching for a specific function or variable name, you'll probably use the Find command, which appears in the Search menu. When you begin the search, you can specify several criteria, such as case sensitivity, the search origin, the range of text to search, and the search direction.

Once you've executed the initial search command, you can press [F3] to repeat the search, starting from the location of the word you just found. However, if you're not careful, you may press [F3] inadvertently and skip past the location you were searching for.

To return to the previous location, you might be tempted to reopen the Find Text dialog box, reverse the search direction, and return to the location that you just accidentally skipped. However, this many steps are unnecessary.

In the IDE, each movement of the cursor­­such as pressing [F3] to repeat a search­­qualifies as a separate command. Therefore, if you press [Alt][Backspace], or simply choose Undo from the Edit menu, the IDE will reposition the cursor at the location of the previously found text.

Return to the Borland C++ Developer's Journal index

Subscribe to the Borland C++ Developer's Journal


Copyright (c) 1996 The Cobb Group, a division of Ziff-Davis Publishing Company. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of Ziff-Davis Publishing Company is prohibited. The Cobb Group and The Cobb Group logo are trademarks of Ziff-Davis Publishing Company.